Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Job](Fix)Improve Event Publishing with Timeout #45103

Merged
merged 8 commits into from
Dec 11, 2024

Conversation

CalvinKirs
Copy link
Member

@CalvinKirs CalvinKirs commented Dec 6, 2024

Summary:

This PR refines the publishEvent method to improve event publishing reliability by introducing a timeout mechanism and enhanced logging. The changes allow for a more responsive system when attempting to publish events to the disruptor, especially in cases where the ring buffer may not have sufficient capacity at the time.

Timeout Implementation:

A 1-second timeout (in nanoseconds) is set, after which the event publishing attempt will stop if the required capacity is not available. The timeout is tracked using System.nanoTime() for precise elapsed time measurement.

Remaining Capacity Check:

The method checks if the remainingCapacity() of the ring buffer is greater than 1 (this can be adjusted based on your capacity requirements). If enough capacity is available, the event is published; otherwise, it waits and retries.

Check List (For Author)

  • Test

    • Regression test
    • Unit Test
    • Manual test (add detailed scripts or steps below)
    • No need to test or manual test. Explain why:
      • This is a refactor/code format and no logic has been changed.
      • Previous test can cover this change.
      • No code files have been changed.
      • Other reason
  • Behavior changed:

    • No.
    • Yes.
  • Does this need documentation?

    • No.
    • Yes.

Check List (For Reviewer who merge this PR)

  • Confirm the release note
  • Confirm test cases
  • Confirm document
  • Add branch pick label

### Summary:
This PR refines the publishEvent method to improve event publishing reliability by introducing a timeout mechanism and enhanced logging. The changes allow for a more responsive system when attempting to publish events to the disruptor, especially in cases where the ring buffer may not have sufficient capacity at the time.

#### Timeout Implementation:

A 1-second timeout (in nanoseconds) is set, after which the event publishing attempt will stop if the required capacity is not available.
The timeout is tracked using System.nanoTime() for precise elapsed time measurement.
#### Remaining Capacity Check:

The method checks if the remainingCapacity() of the ring buffer is greater than 1 (this can be adjusted based on your capacity requirements). If enough capacity is available, the event is published; otherwise, it waits and retries.
@doris-robot
Copy link

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@CalvinKirs
Copy link
Member Author

run buildall

@doris-robot
Copy link

TPC-H: Total hot run time: 40121 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit cffeac88213e844b2068e64fdd6b2ff3c3727354, data reload: false

------ Round 1 ----------------------------------
q1	17600	7825	7297	7297
q2	2051	175	171	171
q3	10590	1091	1141	1091
q4	10555	696	756	696
q5	7618	2671	2699	2671
q6	237	145	145	145
q7	1026	622	608	608
q8	9235	1806	1899	1806
q9	6662	6452	6489	6452
q10	7053	2309	2293	2293
q11	467	267	261	261
q12	423	225	220	220
q13	18082	3025	3099	3025
q14	262	215	210	210
q15	557	545	528	528
q16	649	603	591	591
q17	982	531	558	531
q18	7196	6763	6791	6763
q19	1342	1116	1020	1020
q20	467	186	185	185
q21	4120	3347	3246	3246
q22	371	311	315	311
Total cold run time: 107545 ms
Total hot run time: 40121 ms

----- Round 2, with runtime_filter_mode=off -----
q1	7403	7403	7356	7356
q2	328	239	231	231
q3	2924	3015	2993	2993
q4	2109	1884	1925	1884
q5	5671	5743	5750	5743
q6	226	142	136	136
q7	2269	1878	1880	1878
q8	3374	3587	3623	3587
q9	9266	9328	9366	9328
q10	3686	3662	3645	3645
q11	625	522	532	522
q12	878	715	683	683
q13	17997	3313	3303	3303
q14	303	274	272	272
q15	582	530	534	530
q16	699	657	644	644
q17	1897	1638	1628	1628
q18	8331	7904	7479	7479
q19	1761	1477	1407	1407
q20	2114	1886	1882	1882
q21	5610	5457	5447	5447
q22	643	593	569	569
Total cold run time: 78696 ms
Total hot run time: 61147 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 197667 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit cffeac88213e844b2068e64fdd6b2ff3c3727354, data reload: false

query1	1491	991	971	971
query2	6247	2179	2094	2094
query3	10992	4353	4256	4256
query4	66866	28729	23556	23556
query5	4952	499	502	499
query6	433	185	177	177
query7	5535	317	304	304
query8	331	244	248	244
query9	8765	2754	2752	2752
query10	436	250	252	250
query11	17195	15303	15956	15303
query12	160	103	112	103
query13	1478	427	407	407
query14	10373	7186	7033	7033
query15	222	197	199	197
query16	7137	471	513	471
query17	1070	616	610	610
query18	2099	329	310	310
query19	221	162	164	162
query20	124	113	113	113
query21	215	117	108	108
query22	4708	4495	4526	4495
query23	34992	34557	34659	34557
query24	5533	2503	2558	2503
query25	497	386	389	386
query26	638	160	157	157
query27	1873	284	292	284
query28	4507	2519	2516	2516
query29	651	410	422	410
query30	207	160	153	153
query31	1013	850	844	844
query32	67	53	56	53
query33	480	316	302	302
query34	953	546	541	541
query35	867	779	763	763
query36	1091	966	980	966
query37	121	72	77	72
query38	4488	4364	4444	4364
query39	1522	1489	1494	1489
query40	214	99	111	99
query41	52	43	44	43
query42	113	104	102	102
query43	556	522	502	502
query44	1191	818	840	818
query45	192	182	175	175
query46	1174	749	740	740
query47	2045	1916	1926	1916
query48	408	330	317	317
query49	733	401	390	390
query50	869	399	414	399
query51	7398	7298	7011	7011
query52	101	83	88	83
query53	264	188	180	180
query54	506	399	410	399
query55	78	76	77	76
query56	252	260	238	238
query57	1276	1138	1136	1136
query58	217	210	223	210
query59	3320	2888	2945	2888
query60	275	240	249	240
query61	107	106	132	106
query62	778	700	656	656
query63	212	198	193	193
query64	1363	659	635	635
query65	3351	3246	3239	3239
query66	705	295	316	295
query67	15933	15568	15947	15568
query68	4136	583	577	577
query69	431	265	253	253
query70	1179	1152	1153	1152
query71	347	257	251	251
query72	6427	4039	4021	4021
query73	764	359	367	359
query74	10192	9036	9078	9036
query75	3396	2727	2687	2687
query76	1940	1135	1076	1076
query77	466	280	285	280
query78	10366	9412	9431	9412
query79	1805	605	615	605
query80	870	433	444	433
query81	503	229	233	229
query82	345	133	117	117
query83	175	149	146	146
query84	283	73	71	71
query85	1088	312	301	301
query86	417	298	304	298
query87	4674	4630	4601	4601
query88	4127	2211	2192	2192
query89	411	299	296	296
query90	2117	202	188	188
query91	136	101	103	101
query92	62	50	51	50
query93	2517	545	545	545
query94	855	271	304	271
query95	354	250	271	250
query96	636	275	276	275
query97	2874	2672	2700	2672
query98	214	193	199	193
query99	1612	1321	1300	1300
Total cold run time: 319952 ms
Total hot run time: 197667 ms

@doris-robot
Copy link

ClickBench: Total hot run time: 32.64 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit cffeac88213e844b2068e64fdd6b2ff3c3727354, data reload: false

query1	0.03	0.03	0.03
query2	0.07	0.03	0.04
query3	0.23	0.07	0.07
query4	1.62	0.10	0.11
query5	0.42	0.39	0.40
query6	1.18	0.66	0.66
query7	0.02	0.02	0.01
query8	0.04	0.03	0.03
query9	0.58	0.52	0.50
query10	0.56	0.57	0.55
query11	0.14	0.10	0.11
query12	0.14	0.12	0.11
query13	0.62	0.60	0.60
query14	2.78	2.76	2.75
query15	0.92	0.83	0.83
query16	0.39	0.38	0.38
query17	0.97	1.02	1.04
query18	0.21	0.21	0.20
query19	1.94	1.85	1.94
query20	0.01	0.02	0.01
query21	15.37	0.60	0.59
query22	3.04	2.16	2.29
query23	16.99	1.05	0.77
query24	3.20	0.74	1.40
query25	0.27	0.08	0.23
query26	0.36	0.14	0.14
query27	0.04	0.04	0.05
query28	10.66	1.10	1.08
query29	12.57	3.27	3.23
query30	0.25	0.07	0.06
query31	2.86	0.39	0.37
query32	3.29	0.48	0.49
query33	2.97	3.01	3.05
query34	17.09	4.42	4.43
query35	4.52	4.45	4.46
query36	0.68	0.51	0.51
query37	0.09	0.06	0.06
query38	0.05	0.03	0.04
query39	0.03	0.02	0.02
query40	0.16	0.13	0.12
query41	0.07	0.02	0.02
query42	0.03	0.02	0.02
query43	0.04	0.03	0.02
Total cold run time: 107.5 s
Total hot run time: 32.64 s

return true;

// Timeout reached without publishing the event
LOG.warn("Failed to publish event within the specified timeout (1 second)."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In log, it should be current size of the buffer, not remaining size of the buffer?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes...done

@CalvinKirs
Copy link
Member Author

run buildall

@doris-robot
Copy link

TPC-H: Total hot run time: 40031 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 38b7220967f21361237de630bb98114275f03c71, data reload: false

------ Round 1 ----------------------------------
q1	17636	7515	7285	7285
q2	2044	172	186	172
q3	10609	1112	1166	1112
q4	10515	804	733	733
q5	7616	2683	2748	2683
q6	241	146	146	146
q7	1016	631	601	601
q8	9262	1897	1960	1897
q9	6720	6534	6494	6494
q10	7035	2277	2330	2277
q11	467	263	259	259
q12	428	217	221	217
q13	17793	3020	3061	3020
q14	263	216	212	212
q15	582	535	515	515
q16	668	606	577	577
q17	1001	540	545	540
q18	7274	6780	6703	6703
q19	1337	1038	919	919
q20	449	192	181	181
q21	4036	3313	3177	3177
q22	400	329	311	311
Total cold run time: 107392 ms
Total hot run time: 40031 ms

----- Round 2, with runtime_filter_mode=off -----
q1	7242	7259	7263	7259
q2	330	238	229	229
q3	2938	2808	2970	2808
q4	2030	1843	1840	1840
q5	5725	5673	5659	5659
q6	223	140	146	140
q7	2272	1845	1779	1779
q8	3429	3541	3508	3508
q9	9039	9111	9131	9111
q10	3605	3555	3607	3555
q11	599	503	522	503
q12	847	599	596	596
q13	12070	3274	3247	3247
q14	309	292	274	274
q15	570	521	518	518
q16	692	642	657	642
q17	1885	1644	1630	1630
q18	8339	7798	7622	7622
q19	1695	1465	1454	1454
q20	2126	1883	1876	1876
q21	5625	5506	5366	5366
q22	645	574	562	562
Total cold run time: 72235 ms
Total hot run time: 60178 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 197618 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit 38b7220967f21361237de630bb98114275f03c71, data reload: false

query1	1281	942	933	933
query2	6238	2104	2083	2083
query3	11126	4644	4660	4644
query4	33220	23466	23548	23466
query5	3496	495	458	458
query6	269	182	183	182
query7	3989	302	302	302
query8	300	239	243	239
query9	9756	2725	2720	2720
query10	452	268	256	256
query11	18097	15539	15237	15237
query12	160	105	102	102
query13	1571	426	425	425
query14	9720	7092	6826	6826
query15	281	209	222	209
query16	8109	475	444	444
query17	1822	616	564	564
query18	2212	309	299	299
query19	376	152	153	152
query20	121	115	113	113
query21	206	106	105	105
query22	4887	4462	4413	4413
query23	35638	34528	34661	34528
query24	10499	2646	2598	2598
query25	589	404	404	404
query26	928	150	152	150
query27	2158	289	293	289
query28	6910	2536	2454	2454
query29	771	418	405	405
query30	236	149	154	149
query31	1044	857	836	836
query32	91	55	55	55
query33	799	286	289	286
query34	1231	499	533	499
query35	936	748	769	748
query36	1115	944	968	944
query37	132	77	75	75
query38	4547	4430	4457	4430
query39	1557	1484	1514	1484
query40	216	103	110	103
query41	48	48	42	42
query42	107	100	99	99
query43	550	497	499	497
query44	1212	820	814	814
query45	190	170	169	169
query46	1189	724	731	724
query47	2057	1963	1930	1930
query48	427	318	328	318
query49	940	392	389	389
query50	845	407	395	395
query51	7353	7264	7267	7264
query52	98	89	90	89
query53	256	179	188	179
query54	1300	403	419	403
query55	80	78	86	78
query56	263	245	228	228
query57	1255	1101	1098	1098
query58	223	214	201	201
query59	3303	3058	2943	2943
query60	279	246	247	246
query61	138	110	108	108
query62	914	673	672	672
query63	210	200	188	188
query64	3919	675	656	656
query65	3315	3224	3246	3224
query66	828	306	297	297
query67	15821	15642	15652	15642
query68	4363	551	547	547
query69	425	243	247	243
query70	1204	1099	1149	1099
query71	410	244	245	244
query72	6272	4009	4134	4009
query73	768	354	365	354
query74	10346	8973	9084	8973
query75	3411	2684	2658	2658
query76	2843	1102	1063	1063
query77	375	284	270	270
query78	10574	9524	9571	9524
query79	1679	594	602	594
query80	1106	422	433	422
query81	546	221	234	221
query82	974	120	115	115
query83	235	141	145	141
query84	228	70	72	70
query85	1298	301	306	301
query86	397	304	290	290
query87	4700	4579	4573	4573
query88	3450	2255	2224	2224
query89	428	288	288	288
query90	1911	189	192	189
query91	141	104	118	104
query92	56	50	50	50
query93	1839	532	537	532
query94	865	288	292	288
query95	360	253	251	251
query96	626	278	312	278
query97	2884	2700	2701	2700
query98	222	199	194	194
query99	1573	1307	1315	1307
Total cold run time: 300715 ms
Total hot run time: 197618 ms

@doris-robot
Copy link

ClickBench: Total hot run time: 33.23 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 38b7220967f21361237de630bb98114275f03c71, data reload: false

query1	0.04	0.03	0.03
query2	0.06	0.03	0.03
query3	0.24	0.07	0.07
query4	1.61	0.11	0.10
query5	0.43	0.41	0.42
query6	1.15	0.68	0.65
query7	0.02	0.02	0.01
query8	0.04	0.03	0.03
query9	0.59	0.50	0.52
query10	0.56	0.56	0.56
query11	0.13	0.11	0.11
query12	0.13	0.11	0.11
query13	0.61	0.62	0.60
query14	2.73	2.75	2.77
query15	0.90	0.83	0.82
query16	0.37	0.37	0.38
query17	0.99	1.03	1.07
query18	0.21	0.21	0.21
query19	1.92	1.80	2.03
query20	0.02	0.01	0.02
query21	15.35	0.58	0.59
query22	2.52	1.98	2.38
query23	17.06	0.93	0.88
query24	3.25	1.31	1.28
query25	0.27	0.13	0.16
query26	0.44	0.14	0.13
query27	0.04	0.05	0.04
query28	10.18	1.10	1.08
query29	12.61	3.22	3.25
query30	0.24	0.06	0.06
query31	2.85	0.39	0.38
query32	3.26	0.46	0.45
query33	2.95	3.03	3.02
query34	16.82	4.53	4.50
query35	4.58	4.53	4.52
query36	0.67	0.48	0.47
query37	0.09	0.06	0.06
query38	0.04	0.03	0.04
query39	0.03	0.02	0.02
query40	0.17	0.14	0.13
query41	0.08	0.02	0.03
query42	0.04	0.02	0.02
query43	0.04	0.03	0.03
Total cold run time: 106.33 s
Total hot run time: 33.23 s

@CalvinKirs
Copy link
Member Author

run buildall

@doris-robot
Copy link

TPC-H: Total hot run time: 39932 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 56234593e352031d99ac4810a715317ff8db67b8, data reload: false

------ Round 1 ----------------------------------
q1	17579	7487	7308	7308
q2	2044	182	159	159
q3	10873	1074	1224	1074
q4	10547	737	752	737
q5	7612	2683	2668	2668
q6	237	148	149	148
q7	1006	630	607	607
q8	9251	1797	1852	1797
q9	6667	6354	6451	6354
q10	6978	2300	2331	2300
q11	490	257	259	257
q12	420	215	219	215
q13	17768	3045	3105	3045
q14	225	210	205	205
q15	585	530	519	519
q16	644	595	603	595
q17	957	581	604	581
q18	7363	6662	6768	6662
q19	1341	1072	1006	1006
q20	469	182	182	182
q21	4057	3299	3203	3203
q22	380	310	311	310
Total cold run time: 107493 ms
Total hot run time: 39932 ms

----- Round 2, with runtime_filter_mode=off -----
q1	7216	7213	7195	7195
q2	321	227	236	227
q3	2906	2849	2895	2849
q4	2090	1800	1825	1800
q5	5676	5662	5636	5636
q6	224	139	141	139
q7	2258	1831	1824	1824
q8	3379	3496	3441	3441
q9	8866	9078	9045	9045
q10	3590	3554	3566	3554
q11	626	519	492	492
q12	840	578	612	578
q13	9717	3287	3201	3201
q14	310	270	271	270
q15	575	518	532	518
q16	679	629	636	629
q17	1848	1610	1636	1610
q18	8162	7636	7587	7587
q19	1674	1420	1537	1420
q20	2108	1878	1896	1878
q21	5660	5570	5482	5482
q22	636	612	601	601
Total cold run time: 69361 ms
Total hot run time: 59976 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 197458 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit 56234593e352031d99ac4810a715317ff8db67b8, data reload: false

query1	1260	960	943	943
query2	6236	2089	2029	2029
query3	11002	4477	4467	4467
query4	66950	28635	23572	23572
query5	4903	446	449	446
query6	411	186	181	181
query7	5519	301	297	297
query8	321	239	245	239
query9	8594	2710	2713	2710
query10	432	247	242	242
query11	17114	15351	15875	15351
query12	150	109	108	108
query13	1430	429	419	419
query14	9924	8011	7052	7052
query15	234	191	200	191
query16	7123	446	503	446
query17	1427	617	592	592
query18	1831	327	318	318
query19	220	164	161	161
query20	124	116	111	111
query21	209	106	106	106
query22	4669	4521	4487	4487
query23	34696	34353	34438	34353
query24	5869	2491	2557	2491
query25	487	377	386	377
query26	696	153	149	149
query27	2061	277	299	277
query28	4377	2510	2511	2510
query29	689	445	408	408
query30	218	150	155	150
query31	1032	840	859	840
query32	75	55	55	55
query33	460	287	304	287
query34	977	532	553	532
query35	914	800	770	770
query36	1088	945	968	945
query37	123	74	79	74
query38	4563	4483	4480	4480
query39	1569	1474	1491	1474
query40	199	104	103	103
query41	44	45	44	44
query42	120	99	104	99
query43	542	499	503	499
query44	1198	838	856	838
query45	214	173	179	173
query46	1178	744	757	744
query47	2004	1939	1917	1917
query48	443	322	325	322
query49	741	392	394	392
query50	848	410	396	396
query51	7441	7244	7031	7031
query52	101	89	93	89
query53	271	177	179	177
query54	521	398	387	387
query55	76	76	78	76
query56	256	236	249	236
query57	1255	1082	1101	1082
query58	209	205	207	205
query59	3167	3000	2993	2993
query60	270	243	250	243
query61	119	106	108	106
query62	806	659	671	659
query63	214	191	200	191
query64	1446	671	641	641
query65	3277	3275	3255	3255
query66	721	291	310	291
query67	15960	15686	15653	15653
query68	3706	590	562	562
query69	488	253	250	250
query70	1190	1181	1141	1141
query71	354	254	250	250
query72	6386	4098	4058	4058
query73	791	356	374	356
query74	10348	8978	9167	8978
query75	3389	2635	2690	2635
query76	1823	1083	1122	1083
query77	458	268	267	267
query78	10574	9472	9394	9394
query79	1147	602	610	602
query80	839	426	491	426
query81	486	243	225	225
query82	1342	121	120	120
query83	254	146	146	146
query84	278	70	69	69
query85	870	298	311	298
query86	343	293	299	293
query87	4664	4518	4614	4518
query88	3285	2193	2158	2158
query89	421	299	302	299
query90	2067	188	187	187
query91	142	102	101	101
query92	67	52	52	52
query93	1342	530	536	530
query94	769	297	288	288
query95	350	250	242	242
query96	612	277	284	277
query97	2798	2676	2657	2657
query98	224	208	187	187
query99	1614	1327	1329	1327
Total cold run time: 317039 ms
Total hot run time: 197458 ms

@doris-robot
Copy link

ClickBench: Total hot run time: 32.36 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 56234593e352031d99ac4810a715317ff8db67b8, data reload: false

query1	0.03	0.03	0.05
query2	0.08	0.03	0.03
query3	0.23	0.07	0.07
query4	1.63	0.10	0.10
query5	0.43	0.41	0.41
query6	1.14	0.65	0.65
query7	0.02	0.01	0.02
query8	0.04	0.04	0.03
query9	0.59	0.50	0.50
query10	0.55	0.57	0.60
query11	0.14	0.10	0.10
query12	0.14	0.11	0.11
query13	0.61	0.61	0.60
query14	2.83	2.74	2.75
query15	0.91	0.82	0.82
query16	0.38	0.38	0.38
query17	1.06	1.06	1.05
query18	0.23	0.21	0.21
query19	1.86	1.76	2.04
query20	0.01	0.01	0.01
query21	15.38	0.56	0.58
query22	2.51	2.43	1.53
query23	17.13	0.89	0.69
query24	2.90	1.47	1.19
query25	0.25	0.23	0.17
query26	0.46	0.13	0.13
query27	0.04	0.04	0.04
query28	10.42	1.10	1.07
query29	12.57	3.22	3.24
query30	0.24	0.06	0.06
query31	2.86	0.38	0.38
query32	3.29	0.47	0.46
query33	2.98	2.98	3.14
query34	16.97	4.44	4.48
query35	4.54	4.49	4.48
query36	0.68	0.48	0.48
query37	0.09	0.06	0.06
query38	0.05	0.03	0.04
query39	0.03	0.02	0.02
query40	0.16	0.12	0.12
query41	0.07	0.03	0.02
query42	0.03	0.03	0.02
query43	0.04	0.03	0.03
Total cold run time: 106.6 s
Total hot run time: 32.36 s

@CalvinKirs
Copy link
Member Author

run buildall

@doris-robot
Copy link

TPC-H: Total hot run time: 39984 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 7ddc38b64b31a83317166a377b245b65b8e0de49, data reload: false

------ Round 1 ----------------------------------
q1	17588	7548	7363	7363
q2	2045	174	171	171
q3	10631	1115	1140	1115
q4	10574	728	692	692
q5	7630	2653	2740	2653
q6	241	149	150	149
q7	976	620	602	602
q8	9246	1875	1937	1875
q9	6678	6602	6422	6422
q10	6999	2297	2337	2297
q11	463	257	259	257
q12	434	218	214	214
q13	17772	3025	3063	3025
q14	247	217	211	211
q15	593	533	519	519
q16	665	586	597	586
q17	982	528	488	488
q18	7140	6753	6702	6702
q19	1331	992	1022	992
q20	449	182	176	176
q21	4141	3206	3155	3155
q22	379	327	320	320
Total cold run time: 107204 ms
Total hot run time: 39984 ms

----- Round 2, with runtime_filter_mode=off -----
q1	7372	7302	7642	7302
q2	335	237	229	229
q3	2923	2827	2981	2827
q4	2067	1835	1859	1835
q5	5641	5702	5632	5632
q6	225	144	146	144
q7	2238	1849	1759	1759
q8	3398	3537	3457	3457
q9	8943	9097	9076	9076
q10	3632	3550	3576	3550
q11	594	517	527	517
q12	831	645	600	600
q13	10871	3237	3274	3237
q14	307	259	276	259
q15	583	534	528	528
q16	682	618	642	618
q17	1831	1642	1608	1608
q18	8258	7942	7637	7637
q19	1691	1618	1588	1588
q20	2125	1929	1868	1868
q21	5625	5403	5599	5403
q22	660	580	557	557
Total cold run time: 70832 ms
Total hot run time: 60231 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 196827 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit 7ddc38b64b31a83317166a377b245b65b8e0de49, data reload: false

query1	1241	944	934	934
query2	6267	2112	2051	2051
query3	11091	4341	4477	4341
query4	66980	28525	23437	23437
query5	4930	457	443	443
query6	457	183	173	173
query7	5516	298	292	292
query8	317	241	243	241
query9	8497	2718	2711	2711
query10	435	239	243	239
query11	17131	15388	15840	15388
query12	144	104	104	104
query13	1415	439	448	439
query14	9758	7733	7356	7356
query15	226	193	197	193
query16	7238	503	484	484
query17	1079	568	598	568
query18	1760	323	315	315
query19	202	170	164	164
query20	125	114	112	112
query21	217	112	103	103
query22	4724	4525	4489	4489
query23	34830	34220	34438	34220
query24	5549	2501	2538	2501
query25	505	388	387	387
query26	716	147	154	147
query27	2095	281	278	278
query28	4595	2529	2461	2461
query29	673	426	421	421
query30	222	159	166	159
query31	1012	834	837	834
query32	62	55	53	53
query33	448	289	308	289
query34	938	515	539	515
query35	895	763	732	732
query36	1093	968	962	962
query37	122	71	94	71
query38	4508	4397	4378	4378
query39	1523	1458	1497	1458
query40	199	100	101	100
query41	44	42	41	41
query42	109	99	101	99
query43	554	501	501	501
query44	1202	819	837	819
query45	190	178	171	171
query46	1168	760	743	743
query47	2085	1948	1930	1930
query48	416	331	331	331
query49	745	391	403	391
query50	832	386	390	386
query51	7388	7250	7047	7047
query52	99	92	84	84
query53	257	176	179	176
query54	501	398	392	392
query55	76	75	76	75
query56	252	244	232	232
query57	1272	1122	1129	1122
query58	219	208	223	208
query59	3131	2965	2798	2798
query60	270	236	239	236
query61	107	103	100	100
query62	800	682	668	668
query63	216	185	182	182
query64	1766	705	644	644
query65	3263	3170	3179	3170
query66	744	311	290	290
query67	15991	15637	15728	15637
query68	3707	577	568	568
query69	431	255	251	251
query70	1195	1166	1086	1086
query71	409	309	245	245
query72	6365	4025	3961	3961
query73	776	351	359	351
query74	10282	8994	9057	8994
query75	3373	2658	2628	2628
query76	1812	1054	1067	1054
query77	536	262	265	262
query78	10546	9472	9459	9459
query79	1698	596	609	596
query80	1060	418	481	418
query81	498	231	234	231
query82	1267	115	118	115
query83	177	142	144	142
query84	282	77	71	71
query85	912	292	293	292
query86	351	276	306	276
query87	4753	4582	4540	4540
query88	3778	2199	2153	2153
query89	418	298	284	284
query90	1986	185	182	182
query91	143	100	101	100
query92	71	51	55	51
query93	1929	540	540	540
query94	772	280	307	280
query95	346	243	254	243
query96	619	286	278	278
query97	2828	2647	2654	2647
query98	215	190	199	190
query99	1627	1323	1325	1323
Total cold run time: 318594 ms
Total hot run time: 196827 ms

@doris-robot
Copy link

ClickBench: Total hot run time: 32.89 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 7ddc38b64b31a83317166a377b245b65b8e0de49, data reload: false

query1	0.03	0.03	0.03
query2	0.07	0.03	0.04
query3	0.23	0.07	0.07
query4	1.62	0.10	0.10
query5	0.41	0.41	0.42
query6	1.16	0.67	0.65
query7	0.02	0.01	0.02
query8	0.04	0.04	0.03
query9	0.59	0.52	0.52
query10	0.56	0.56	0.55
query11	0.15	0.11	0.10
query12	0.13	0.11	0.11
query13	0.61	0.61	0.59
query14	2.72	2.83	2.73
query15	0.92	0.82	0.83
query16	0.38	0.40	0.39
query17	1.10	1.09	1.04
query18	0.23	0.22	0.20
query19	1.85	1.76	2.02
query20	0.02	0.01	0.01
query21	15.35	0.61	0.56
query22	2.37	2.97	2.03
query23	17.02	0.93	0.93
query24	3.26	0.98	1.20
query25	0.20	0.19	0.08
query26	0.48	0.13	0.13
query27	0.04	0.05	0.04
query28	10.68	1.08	1.07
query29	12.53	3.18	3.19
query30	0.25	0.06	0.06
query31	2.86	0.38	0.39
query32	3.28	0.47	0.46
query33	2.97	3.03	3.03
query34	16.78	4.52	4.50
query35	4.60	4.53	4.60
query36	0.66	0.47	0.47
query37	0.09	0.06	0.06
query38	0.05	0.04	0.04
query39	0.03	0.03	0.02
query40	0.17	0.13	0.12
query41	0.08	0.03	0.02
query42	0.03	0.02	0.02
query43	0.05	0.03	0.03
Total cold run time: 106.67 s
Total hot run time: 32.89 s

@CalvinKirs
Copy link
Member Author

run buildall

@doris-robot
Copy link

TPC-H: Total hot run time: 39946 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 005b74a119db2f9429a2e8bb4bd4ba9c76bd7360, data reload: false

------ Round 1 ----------------------------------
q1	17571	7515	7250	7250
q2	2039	172	166	166
q3	10604	1075	1154	1075
q4	10575	730	723	723
q5	7595	2717	2647	2647
q6	236	145	143	143
q7	986	633	596	596
q8	9230	1868	1888	1868
q9	6648	6455	6488	6455
q10	7011	2342	2255	2255
q11	461	267	262	262
q12	414	218	228	218
q13	17800	3025	3027	3025
q14	268	211	216	211
q15	575	533	531	531
q16	683	585	580	580
q17	989	543	548	543
q18	7274	6768	6795	6768
q19	1351	995	982	982
q20	458	183	179	179
q21	3990	3195	3155	3155
q22	367	314	318	314
Total cold run time: 107125 ms
Total hot run time: 39946 ms

----- Round 2, with runtime_filter_mode=off -----
q1	7261	7227	7211	7211
q2	332	228	227	227
q3	2865	2786	2971	2786
q4	2129	1865	1855	1855
q5	5710	5676	5643	5643
q6	230	145	141	141
q7	2209	1822	1775	1775
q8	3394	3530	3495	3495
q9	8937	9031	8993	8993
q10	3611	3551	3573	3551
q11	601	499	503	499
q12	811	594	627	594
q13	10804	3217	3235	3217
q14	308	285	271	271
q15	574	527	525	525
q16	690	632	633	632
q17	1862	1640	1609	1609
q18	8321	7824	7656	7656
q19	1682	1442	1505	1442
q20	2114	1852	1866	1852
q21	5668	5471	5461	5461
q22	646	603	558	558
Total cold run time: 70759 ms
Total hot run time: 59993 ms

@doris-robot
Copy link

ClickBench: Total hot run time: 33.32 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 005b74a119db2f9429a2e8bb4bd4ba9c76bd7360, data reload: false

query1	0.04	0.03	0.03
query2	0.07	0.03	0.03
query3	0.23	0.08	0.07
query4	1.64	0.11	0.11
query5	0.42	0.42	0.43
query6	1.17	0.66	0.66
query7	0.02	0.02	0.02
query8	0.05	0.03	0.03
query9	0.57	0.51	0.50
query10	0.55	0.55	0.56
query11	0.14	0.10	0.11
query12	0.14	0.11	0.11
query13	0.62	0.60	0.61
query14	2.71	2.74	2.85
query15	0.89	0.82	0.81
query16	0.40	0.38	0.38
query17	1.00	1.05	1.05
query18	0.22	0.20	0.21
query19	1.99	1.85	1.97
query20	0.01	0.01	0.02
query21	15.38	0.58	0.58
query22	2.42	2.68	2.57
query23	17.20	0.90	0.72
query24	3.01	0.79	1.70
query25	0.28	0.14	0.07
query26	0.36	0.13	0.13
query27	0.05	0.05	0.05
query28	10.47	1.10	1.07
query29	12.58	3.32	3.32
query30	0.26	0.06	0.07
query31	2.85	0.39	0.38
query32	3.27	0.46	0.46
query33	3.00	3.08	3.08
query34	16.85	4.52	4.56
query35	4.55	4.47	4.49
query36	0.67	0.48	0.47
query37	0.09	0.07	0.06
query38	0.05	0.03	0.03
query39	0.04	0.02	0.03
query40	0.17	0.13	0.13
query41	0.08	0.03	0.02
query42	0.03	0.02	0.02
query43	0.03	0.03	0.03
Total cold run time: 106.57 s
Total hot run time: 33.32 s

morrySnow
morrySnow previously approved these changes Dec 11, 2024
@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Dec 11, 2024
Copy link
Contributor

PR approved by at least one committer and no changes requested.

Copy link
Contributor

PR approved by anyone and no changes requested.

// Check if there is enough remaining capacity in the ring buffer
// Adjusting to check if the required capacity is available (instead of hardcoding 1)
if (disruptor.getRingBuffer().remainingCapacity() > 1) {
// Publish the event if there is enough capacity
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will there be concurrency? When making a judgment, it is greater than 1, and when publishing, there is no capacity left

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, only the time wheel is in use, and since the time wheel itself is single-threaded, there are no issues.

disruptor.getRingBuffer().publishEvent(eventTranslator, args);
if (LOG.isDebugEnabled()) {
LOG.debug("publishEvent success,the remaining buffer size is {}",
disruptor.getRingBuffer().remainingCapacity());
Copy link
Contributor

@zddr zddr Dec 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose of 'remainingCapacity'?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simply to add debug logs.


public boolean addTask(AbstractTask task) {
try {
executor.execute(() -> runTask(task)); // 直接提交任务
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

english

@github-actions github-actions bot removed the approved Indicates a PR has been approved by one committer. label Dec 11, 2024
@CalvinKirs
Copy link
Member Author

run buildall

@doris-robot
Copy link

TPC-H: Total hot run time: 40061 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 68a38eeebdf392d91f874034aebcf6b5108d1999, data reload: false

------ Round 1 ----------------------------------
q1	17606	7329	7302	7302
q2	2042	179	172	172
q3	10542	1118	1145	1118
q4	10222	702	709	702
q5	7593	2705	2702	2702
q6	239	148	147	147
q7	1010	620	619	619
q8	9235	1874	1946	1874
q9	6727	6454	6429	6429
q10	6954	2293	2273	2273
q11	469	260	251	251
q12	428	232	223	223
q13	17786	3029	3012	3012
q14	250	205	208	205
q15	569	539	522	522
q16	628	583	586	583
q17	968	595	609	595
q18	7507	6786	6715	6715
q19	1347	1010	983	983
q20	469	180	181	180
q21	4011	3140	3143	3140
q22	394	320	314	314
Total cold run time: 106996 ms
Total hot run time: 40061 ms

----- Round 2, with runtime_filter_mode=off -----
q1	7193	7214	7225	7214
q2	324	231	243	231
q3	2871	2772	2994	2772
q4	2087	1858	1780	1780
q5	5537	5695	5620	5620
q6	217	141	142	141
q7	2201	1827	1782	1782
q8	3329	3601	3478	3478
q9	8932	8973	8959	8959
q10	3588	3567	3540	3540
q11	591	522	506	506
q12	819	637	624	624
q13	12611	3224	3163	3163
q14	298	265	272	265
q15	564	526	525	525
q16	690	650	616	616
q17	1779	1538	1553	1538
q18	7820	7608	7464	7464
q19	1628	1476	1490	1476
q20	2048	1817	1843	1817
q21	5443	5274	5117	5117
q22	627	570	572	570
Total cold run time: 71197 ms
Total hot run time: 59198 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 191201 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit 68a38eeebdf392d91f874034aebcf6b5108d1999, data reload: false

query1	971	381	364	364
query2	6508	2053	2031	2031
query3	6703	234	223	223
query4	34200	23700	23446	23446
query5	4314	497	462	462
query6	271	187	184	184
query7	4619	305	319	305
query8	309	244	236	236
query9	9485	2709	2715	2709
query10	465	260	263	260
query11	18288	15219	15317	15219
query12	149	106	103	103
query13	1657	423	409	409
query14	10308	6846	7249	6846
query15	303	175	183	175
query16	8205	453	469	453
query17	1652	566	537	537
query18	2120	295	292	292
query19	358	150	150	150
query20	117	105	110	105
query21	205	100	102	100
query22	4575	4323	4288	4288
query23	35374	34194	34228	34194
query24	11518	2499	2545	2499
query25	682	384	383	383
query26	1855	152	155	152
query27	2841	276	277	276
query28	8205	2439	2467	2439
query29	1038	408	413	408
query30	305	149	150	149
query31	1136	850	825	825
query32	108	60	58	58
query33	756	311	283	283
query34	977	505	543	505
query35	862	735	744	735
query36	1094	966	933	933
query37	283	79	74	74
query38	4420	4190	4314	4190
query39	1492	1434	1438	1434
query40	277	106	101	101
query41	48	47	46	46
query42	107	108	103	103
query43	538	501	478	478
query44	1271	829	813	813
query45	185	205	164	164
query46	1159	703	711	703
query47	1910	1853	1828	1828
query48	411	307	315	307
query49	1243	381	382	381
query50	797	399	392	392
query51	7165	7112	7199	7112
query52	99	92	88	88
query53	258	182	181	181
query54	1088	416	404	404
query55	79	83	77	77
query56	298	246	256	246
query57	1268	1113	1102	1102
query58	252	229	214	214
query59	3423	3113	2947	2947
query60	272	249	254	249
query61	118	107	107	107
query62	863	706	678	678
query63	226	190	190	190
query64	5037	673	636	636
query65	3293	3209	3264	3209
query66	1258	313	307	307
query67	15821	15595	15540	15540
query68	4890	546	553	546
query69	433	256	297	256
query70	1177	1111	1164	1111
query71	338	262	249	249
query72	6356	4108	3990	3990
query73	764	355	357	355
query74	10209	9020	9073	9020
query75	3452	2702	2713	2702
query76	3081	1120	1181	1120
query77	513	283	330	283
query78	10464	9435	9403	9403
query79	1612	613	605	605
query80	1141	439	456	439
query81	525	251	226	226
query82	933	118	116	116
query83	236	146	157	146
query84	236	68	73	68
query85	1288	308	307	307
query86	449	304	306	304
query87	4736	4601	4664	4601
query88	3539	2229	2181	2181
query89	413	299	310	299
query90	2014	190	190	190
query91	137	105	108	105
query92	68	51	52	51
query93	1592	539	576	539
query94	845	300	292	292
query95	364	253	252	252
query96	615	279	285	279
query97	2867	2650	2700	2650
query98	223	191	206	191
query99	1572	1303	1288	1288
Total cold run time: 304574 ms
Total hot run time: 191201 ms

@doris-robot
Copy link

ClickBench: Total hot run time: 33.22 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 68a38eeebdf392d91f874034aebcf6b5108d1999, data reload: false

query1	0.03	0.03	0.03
query2	0.06	0.03	0.04
query3	0.24	0.08	0.06
query4	1.62	0.10	0.10
query5	0.43	0.40	0.42
query6	1.16	0.65	0.66
query7	0.01	0.02	0.01
query8	0.04	0.04	0.03
query9	0.57	0.53	0.50
query10	0.56	0.58	0.57
query11	0.14	0.11	0.10
query12	0.14	0.10	0.12
query13	0.61	0.60	0.60
query14	2.72	2.72	2.74
query15	0.91	0.83	0.82
query16	0.37	0.38	0.39
query17	1.02	1.02	1.04
query18	0.23	0.22	0.23
query19	1.93	1.81	1.94
query20	0.01	0.01	0.01
query21	15.36	0.58	0.58
query22	2.71	2.34	2.56
query23	16.97	1.02	0.87
query24	2.64	1.11	1.16
query25	0.40	0.07	0.05
query26	0.44	0.15	0.13
query27	0.05	0.04	0.04
query28	10.87	1.10	1.07
query29	12.60	3.23	3.23
query30	0.25	0.07	0.08
query31	2.85	0.39	0.38
query32	3.30	0.46	0.46
query33	2.98	3.05	3.03
query34	17.22	4.47	4.47
query35	4.50	4.50	4.46
query36	0.64	0.50	0.48
query37	0.09	0.06	0.06
query38	0.04	0.03	0.03
query39	0.03	0.02	0.02
query40	0.17	0.13	0.12
query41	0.08	0.03	0.02
query42	0.03	0.02	0.02
query43	0.04	0.02	0.03
Total cold run time: 107.06 s
Total hot run time: 33.22 s

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Dec 11, 2024
Copy link
Contributor

PR approved by at least one committer and no changes requested.

@CalvinKirs CalvinKirs merged commit 24eae4b into apache:master Dec 11, 2024
27 of 29 checks passed
github-actions bot pushed a commit that referenced this pull request Dec 11, 2024
### Summary:
This PR refines the publishEvent method to improve event publishing
reliability by introducing a timeout mechanism and enhanced logging. The
changes allow for a more responsive system when attempting to publish
events to the disruptor, especially in cases where the ring buffer may
not have sufficient capacity at the time.

#### Timeout Implementation:

A 1-second timeout (in nanoseconds) is set, after which the event
publishing attempt will stop if the required capacity is not available.
The timeout is tracked using System.nanoTime() for precise elapsed time
measurement.

#### Remaining Capacity Check:

The method checks if the remainingCapacity() of the ring buffer is
greater than 1 (this can be adjusted based on your capacity
requirements). If enough capacity is available, the event is published;
otherwise, it waits and retries.
github-actions bot pushed a commit that referenced this pull request Dec 11, 2024
### Summary:
This PR refines the publishEvent method to improve event publishing
reliability by introducing a timeout mechanism and enhanced logging. The
changes allow for a more responsive system when attempting to publish
events to the disruptor, especially in cases where the ring buffer may
not have sufficient capacity at the time.

#### Timeout Implementation:

A 1-second timeout (in nanoseconds) is set, after which the event
publishing attempt will stop if the required capacity is not available.
The timeout is tracked using System.nanoTime() for precise elapsed time
measurement.

#### Remaining Capacity Check:

The method checks if the remainingCapacity() of the ring buffer is
greater than 1 (this can be adjusted based on your capacity
requirements). If enough capacity is available, the event is published;
otherwise, it waits and retries.
@CalvinKirs CalvinKirs deleted the master-dispatch-queue branch December 11, 2024 10:14
CalvinKirs added a commit that referenced this pull request Dec 12, 2024
CalvinKirs added a commit that referenced this pull request Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by one committer. dev/2.1.8-merged dev/3.0.4-merged reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants